package com.winchain.chainbill.chain.callback.cmd;

import com.shell.bee.acct.transaction.po.AcctTxRec;
import com.shell.bee.base.utils.SystemUtil;
import com.shell.framework.command.CommandContext;
import com.shell.framework.command.ICommand;
import com.winchain.chainbill.ChainBillUtil;
import com.winchain.chainbill.chain.callback.service.SyncConfirmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SyncConfirmCmd<T> implements ICommand<T> {
	@Autowired
	private SyncConfirmService syncConfirmService;

	public boolean execute(CommandContext<T> context) throws Exception {
		if (!ChainBillUtil.onChain()) {
			AcctTxRec txRec = (AcctTxRec) context.getValue("acctTxRec");
			this.syncConfirmService.confirm(txRec, SystemUtil.getUUID());
		}
		return false;
	}
}
